﻿using EF6CodeFirstMySQL.Model;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace EF6CodeFirstMySQL.Tests
{
    class Program
    {
        static void Main(string[] args)
        {
            using (var ctx = new DataModelContext())
            {
                foreach (DeliveryNote dn in ctx.DeliveryNotes.Include("Contract"))
                {
                    Console.WriteLine(string.Format("送货单号：{0}，送货日期：{1:yyyy-MM-dd}，到货金额：{2:#0,000.00}，合同编号：{3}，供应商：{4}，合同总金额：{5}，合同总金额(直接属性)：{6}",
                        dn.BillNo, dn.BillDate, dn.TotalPrice, dn.Contract.BillNo, dn.Contract.Supplier, dn.Contract.TotalPrice, dn.ContractTotalPrice));
                }
            }

            Console.WriteLine("\n\n按[回车]键退出...");
            Console.ReadLine();
        }

    }

}
